import React, {createRef, useContext, useEffect, useRef, useState} from 'react';
import {
    ActivityIndicator,
    Alert,
    DeviceEventEmitter,
    Dimensions,
    ImageBackground,
    RefreshControl,
    TextInput,
    TouchableOpacity,
    View,
    Text, ScrollView, Keyboard,
} from 'react-native';
import LocaleContext from '../libs/locale';
import WalletContext from '../libs/wallet';
import {sleep} from "../libs/helpers";
import {TouchableHighlight} from "react-native-gesture-handler";
import {ListItem} from "react-native-elements";


const {width,height,scale} = Dimensions.get("window");


const xxx = ({navigation,route}:any) =>{
    const locale = useContext(LocaleContext);
    const wallet: any = useContext(WalletContext);
    const ref_ScrollView = useRef(null);
    const showSubscription = Keyboard.addListener("keyboardDidShow", () => {
        try {
            (ref_ScrollView as any).current.scrollToEnd({animated: true})
            setTimeout(()=>{
                console.log('onFocus is excuted....');
            },200)
        }catch (e) {
            console.log("refs not null ")
        }
    });
    useEffect(()=>{
        return()=>{
            showSubscription.remove();
        }
    },[])

    return (
        <View style={{flex:1}}>
           <ScrollView
               ref={ref_ScrollView}
               style={{height:height,backgroundColor:"pink"}}>
               <Text style={{fontSize:25,letterSpacing:10}}>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyy</Text>

           </ScrollView>
            <TextInput
                style={{height:200,backgroundColor:"green"}}
                onFocus={()=>{
                }}
            >
            </TextInput>
        </View>
    );
};
export default xxx;



